package com.office.controller;

import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.office.util.RandUtils;


@Controller
@RequestMapping("/common")
public class CommonController {
	// 验证码
	@RequestMapping("/scode")
	public ModelAndView scode(HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		BufferedImage image = RandUtils.getRandomImage(request,
				"admin-login-scode");
		ImageIO.write(image, "JPEG", response.getOutputStream());
		return null;
	}
}
